package com.example.dpcnb.excel.hutool;

import cn.hutool.core.io.resource.ResourceUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/hutool")
@RestController
public class HutoolExcelController {

    // 快捷读取   xlsx表头和Nb 类字段对应    自定义表头使用FastExcel
    @GetMapping("/read")
    public String  read(){

        ExcelReader reader = ExcelUtil.getReader("C:\\Users\\36373\\Desktop\\ab.xlsx");
        ExcelReader reader2 = ExcelUtil.getReader(ResourceUtil.getStream("ab.xlsx"));

        List<Nb> all = reader2.readAll(Nb.class);

        System.out.println("读取完成");
        return "";
    }
}
